﻿<UserControl x:Class="Chapters.Chapter05.GuageSliderExample"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:Chapter05="clr-namespace:FSharp.Chapter5;assembly=FSharpLibrary">
	<UserControl.Resources>
		<DrawingBrush x:Key="DrawingBrush1"
					  Viewbox="0,0,21,121"
					  ViewboxUnits="Absolute">
			<DrawingBrush.Drawing>
				<GeometryDrawing>
					<GeometryDrawing.Brush>
						<RadialGradientBrush>
							<GradientStop Color="#FFF51212"
										  Offset="0" />
							<GradientStop Color="#FFE45808"
										  Offset="1" />
						</RadialGradientBrush>
					</GeometryDrawing.Brush>
					<GeometryDrawing.Geometry>
						<PathGeometry Figures="M149.50001,79.499991 C149.50001,79.499991 139.49997,189.49994 139.49997,189.49994 139.49997,189.49994 149.50001,199.49994 149.50001,199.49994 L159.50005,189.49994 z">
							<PathGeometry.Transform>
								<MatrixTransform Matrix="0.999996185317286,0,0,1.00000044504821,-138.9994373343,-79.000027751935" />
							</PathGeometry.Transform>
						</PathGeometry>
					</GeometryDrawing.Geometry>
					<GeometryDrawing.Pen>
						<Pen Brush="#FF000000"
							 DashCap="Flat"
							 EndLineCap="Flat"
							 LineJoin="Miter"
							 MiterLimit="10"
							 StartLineCap="Flat"
							 Thickness="1" />
					</GeometryDrawing.Pen>
				</GeometryDrawing>
			</DrawingBrush.Drawing>
		</DrawingBrush>

		<ControlTemplate x:Key="SliderTemplate"
						 TargetType="Slider">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition />
				</Grid.RowDefinitions>
				<Chapter05:Guage Ticks="100"
								 TickSize="1,25"
								 Grid.Row="0"
								 Grid.RowSpan="2"
								 TickBrush="Gray" />
				<Chapter05:Guage Ticks="20"
								 TickSize="2,50"
								 Grid.Row="0"
								 Grid.RowSpan="2"
								 TickBrush="IndianRed"
								 x:Name="PART_Track" />
				<TextBlock Text="WPF Speedometer"
						   FontSize="14"
						   Foreground="Black"
						   HorizontalAlignment="Center"
						   VerticalAlignment="Center" />
				<Rectangle Grid.Row="0"
						   VerticalAlignment="Stretch"
						   RenderTransformOrigin="0.5,1"
						   Width="50"
						   Opacity="0.75"
						   Fill="{StaticResource DrawingBrush1}">
					<Rectangle.RenderTransform>
						<RotateTransform Angle="{Binding Value, RelativeSource={RelativeSource TemplatedParent}}" />
					</Rectangle.RenderTransform>
				</Rectangle>

			</Grid>
		</ControlTemplate>
	</UserControl.Resources>
	<DockPanel>
		<TextBlock Text="{Binding Value, ElementName=_slider}"
				   DockPanel.Dock="Top" />
		<Slider x:Name="_moveSlider"
				Minimum="-90"
				Maximum="90"
				Value="45"
				Orientation="Vertical"
				Width="50"
				Margin="20,0,0,0"
				VerticalAlignment="Top"
				Height="200"
				DockPanel.Dock="Left" />
		<Slider x:Name="_slider"
				Minimum="-90"
				Maximum="90"
				Template="{StaticResource SliderTemplate}"
				Value="{Binding Value, ElementName=_moveSlider}" />
	</DockPanel>
</UserControl>
